package com.jetbrains.kmpapp.utils

import platform.Foundation.NSLog
import kotlin.experimental.ExperimentalNativeApi

private class LoggerImpl(override val tag: String): Logger {

    @OptIn(ExperimentalNativeApi::class)
    override fun log(level: LogLevel, message: String, throwable: Throwable?) {
        NSLog("%s/ %@: %@", level.name, tag, message)
        throwable?.let {
            // 打印异常信息
            NSLog("Throwable: %@", it.toString())
        }
    }

}

actual fun Logger(tag: String): Logger {
    return LoggerImpl(tag)
}